package dashboard.serialize;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;

public class Person implements Serializable {	
	private static final long serialVersionUID = 91282334L;
	//不变量初始不赋值
	public final String name=new String("V2");
	public String job=new String("job");
	public final Random r=new Random();
	public final int counter = r.nextInt();
	//构造函数为不变量赋值
	public Person(){
//		name="混世魔王";
//		Arrays.copyOf(original, newLength);
//		Collections.unmodifiableList(list);
	}
	
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + counter;
		result = prime * result + ((job == null) ? 0 : job.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((r == null) ? 0 : r.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Person other = (Person) obj;
		if (counter != other.counter)
			return false;
		if (job == null) {
			if (other.job != null)
				return false;
		} else if (!job.equals(other.job))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (r == null) {
			if (other.r != null)
				return false;
		} else if (!r.equals(other.r))
			return false;
		return true;
	}
}

